__author__ = 'wangjc'

import multiprocessing
import subprocess
from time import ctime

class appiumserver:
    #构建appium进程组
    appium_process=[]
    def appium_start(self,host, port):
        # 加载appium进程
        # for i in range(2):
        port = 4723 + 2
        appium = multiprocessing.Process(target=self.appium_start, args=(host, port))
        self.appium_process.append(appium)

        bootstrap_port = str(port + 1)
        cmd = 'start /b appium -a ' + host + ' -p ' + str(port) + ' --bootstrap-port ' + str(bootstrap_port)

        print('%s at %s' % (cmd, ctime()))
        subprocess.Popen(cmd, shell=True, stderr=subprocess.STDOUT)

